import request from '@/utils/request'

// 获取所有权限
export function getPermission() {
  return request({
    url: '/sys/permission',
    method: 'get'
  })
}
// 添加权限
export function addPermission(data) {
  return request({
    url: '/sys/permission',
    method: 'post',
    data
  })
}
// 删除权限
export function delPermission(id) {
  return request({
    url: `/sys/permission/${id}`,
    method: 'delete'
  })
}
// 根据id获取权限点详情
export function getpermissionDetail(id) {
  return request({
    url: `/sys/permission/${id}`,
    method: 'get'
  })
}
// 根据id编辑权限
export function editPermission(data) {
  return request({
    url: `/sys/permission/${data.id}`,
    method: 'put',
    data
  })
}
// 给角色分配权限
export function assignPermission(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
